using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter22
{
	/// <summary>
	/// Example11: Adiabatic Free Expansion - One Last Time
	/// Let us verify that the macroscopic and microscopic
	/// approaches to the calculation of entropy lead
	/// to the same conclusion for the adiabatic free
	/// expansion of an ideal gas. Suppose that an ideal
	/// gas expands to four times its initial volume.
	/// As we have seen for this process, the initial and
	/// final temperatures are the same.
	/// (A) Using a macroscopic approach, calculate the entropy
	/// change for the gas.
	/// \Delta S = n R ln 4
	/// (B) Using statistical considerations, calculate the change
	/// in entropy for the gas and show that it agrees with the
	/// answer you obtained in part (A).
	/// \Delta S = n R ln 4
	/// </summary>
	public class Example11
	{
		public Example11()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Entropy S = new L.Entropy();
			double N = L.Constant.AvogadroConstant;
			S.NumberOfMicrostates = 4.0; 
			result = Convert.ToString(N*S.JPERK)+"\r\n";
			result += Convert.ToString(1.0*L.Constant.UniversalGasConstant*Math.Log(4.0))+"\r\n";
		}
	}
}
